package a3;

import java.awt.Graphics;

import javax.swing.JFrame;

public class Gui extends JFrame {
		
	private static final long serialVersionUID = -2287835901588607118L;
	Environment Environment;
	DrawingBoard Canvas;
	boolean Enabled;
	long stoptime = 300L;
	
	public Gui(boolean enabled) {
		setSize(500,500);
		Canvas = new DrawingBoard(this);
		Environment = null;
		Enabled = enabled;
		setEnabled(enabled);
		if(Enabled) {
			setVisible(true);
		}
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		getContentPane().add(Canvas);
	}
	
	public void setEnvironment(Environment env) {
		Environment = env;
	}
	
	public void paint(Graphics g) 
	{
		if(Environment != null)
			Canvas.paint(g);
	}
	
	public void repaint() {
		if(Environment != null)
			Canvas.repaint();
	}
}
